﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Marbles.CMS.ContentTypes.Tasks
{
    public class TaskEntryItem
    {
        public int TaskId { get { return this._taskid; } }
        public string Username { get { return this._username; } }
        public string Notes { get { return this._notes; } set { this._notes = value; } }
        public string Subject { get { return this._subject; } set { this._subject = value; } }
        public int TaskStatusId { get { return this._taskstatusid; } set { this._taskstatusid = value; } }
        public int TaskPriorityId { get { return this._taskpriorityid; } set { this._taskpriorityid = value; } }
        public DateTime DueDate { get { return this._duedate; } set { this._duedate = value; } }
        public DateTime StartDate { get { return this._startdate; } set { this._startdate = value; } }
        public string TaskStatus { get { return getTaskStatus(); } }
        public string TaskPriority { get { return getTaskPriority(); } }
        public DateTime CompletionDate { get { return this._completiondate; } set { this._completiondate = value; } }

        private DateTime _completiondate = DateTime.MaxValue;
        private string _subject = string.Empty;
        private int _taskid = 0;
        private string _username = string.Empty;
        private int _taskstatusid = 0;
        private int _taskpriorityid = 0;
        private string _notes = string.Empty;
        private DateTime _duedate = DateTime.MaxValue;
        private DateTime _startdate = DateTime.MinValue;

        public TaskEntryItem(string Username)
        {
            this._taskid = 0;
            this._username = Username;
        }

        public TaskEntryItem(int TaskId, string Username)
        {
            this._taskid = TaskId;
            this._username = Username;
        }

        private string getTaskPriority()
        {
            ContentManager mgr = new ContentManager();
            Dictionary<int, string> items = mgr.GetTaskPriorities();
            return items[this._taskpriorityid];
        }

        private string getTaskStatus()
        {
            ContentManager mgr = new ContentManager();
            Dictionary<int, string> items = mgr.GetTaskStates();
            return items[this._taskstatusid];
        }
    }
}
